package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataScope;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.TStocktakingMapper;
import com.ruoyi.system.domain.TStocktaking;
import com.ruoyi.system.service.ITStocktakingService;
import com.ruoyi.common.core.text.Convert;

/**
 * 盘点 服务层实现
 * 
 * @author ruoyi
 * @date 2019-05-08
 */
@Service
public class TStocktakingServiceImpl implements ITStocktakingService 
{
	@Autowired
	private TStocktakingMapper tStocktakingMapper;

	/**
     * 查询盘点信息
     * 
     * @param stockId 盘点ID
     * @return 盘点信息
     */
    @Override
	public TStocktaking selectTStocktakingById(Long stockId)
	{
	    return tStocktakingMapper.selectTStocktakingById(stockId);
	}
	
	/**
     * 查询盘点列表
     * 
     * @param tStocktaking 盘点信息
     * @return 盘点集合
     */
	@Override
	@DataScope(tableAlias = "t")
	public List<TStocktaking> selectTStocktakingList(TStocktaking tStocktaking)
	{
	    return tStocktakingMapper.selectTStocktakingList(tStocktaking);
	}
	
    /**
     * 新增盘点
     * 
     * @param tStocktaking 盘点信息
     * @return 结果
     */
	@Override
	public int insertTStocktaking(TStocktaking tStocktaking)
	{
	    return tStocktakingMapper.insertTStocktaking(tStocktaking);
	}
	
	/**
     * 修改盘点
     * 
     * @param tStocktaking 盘点信息
     * @return 结果
     */
	@Override
	public int updateTStocktaking(TStocktaking tStocktaking)
	{
	    return tStocktakingMapper.updateTStocktaking(tStocktaking);
	}

	/**
     * 删除盘点对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	@Override
	public int deleteTStocktakingByIds(String ids)
	{
		return tStocktakingMapper.deleteTStocktakingByIds(Convert.toStrArray(ids));
	}

	@Override
	public int deleteByDeptId(Long deptId) {
		return tStocktakingMapper.deleteByDeptId(deptId);
	}

}
